package com.ruoyi.quartz.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.quartz.domain.LotTicketType;
import com.ruoyi.quartz.service.ILotTicketTypeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * tolTypeController
 * 
 * @author ruoyi
 * @date 2024-10-30
 */
@RestController
@RequestMapping("/ticket/tolType")
public class LotTicketTypeController extends BaseController
{
    @Autowired
    private ILotTicketTypeService lotTicketTypeService;

    /**
     * 查询tolType列表
     */
    @PreAuthorize("@ss.hasPermi('ticket:tolType:list')")
    @GetMapping("/list")
    public TableDataInfo list(LotTicketType lotTicketType)
    {
        startPage();
        List<LotTicketType> list = lotTicketTypeService.selectLotTicketTypeList(lotTicketType);
        return getDataTable(list);
    }

    /**
     * 导出tolType列表
     */
    @PreAuthorize("@ss.hasPermi('ticket:tolType:export')")
    @Log(title = "tolType", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LotTicketType lotTicketType)
    {
        List<LotTicketType> list = lotTicketTypeService.selectLotTicketTypeList(lotTicketType);
        ExcelUtil<LotTicketType> util = new ExcelUtil<LotTicketType>(LotTicketType.class);
        util.exportExcel(response, list, "tolType数据");
    }

    /**
     * 获取tolType详细信息
     */
    @PreAuthorize("@ss.hasPermi('ticket:tolType:query')")
    @GetMapping(value = "/{ticketTypeId}")
    public AjaxResult getInfo(@PathVariable("ticketTypeId") Long ticketTypeId)
    {
        return success(lotTicketTypeService.selectLotTicketTypeByTicketTypeId(ticketTypeId));
    }

    /**
     * 新增tolType
     */
    @PreAuthorize("@ss.hasPermi('ticket:tolType:add')")
    @Log(title = "tolType", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LotTicketType lotTicketType)
    {
        return toAjax(lotTicketTypeService.insertLotTicketType(lotTicketType));
    }

    /**
     * 修改tolType
     */
    @PreAuthorize("@ss.hasPermi('ticket:tolType:edit')")
    @Log(title = "tolType", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LotTicketType lotTicketType)
    {
        return toAjax(lotTicketTypeService.updateLotTicketType(lotTicketType));
    }

    /**
     * 删除tolType
     */
    @PreAuthorize("@ss.hasPermi('ticket:tolType:remove')")
    @Log(title = "tolType", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ticketTypeIds}")
    public AjaxResult remove(@PathVariable Long[] ticketTypeIds)
    {
        return toAjax(lotTicketTypeService.deleteLotTicketTypeByTicketTypeIds(ticketTypeIds));
    }
}
